<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html style="height: 100%">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
		<title>DataSet</title>
		<link rel="stylesheet" href="dorado/scripts/attachement/attachment-ico.css">
		<link rel="stylesheet" href="dorado/scripts/attachement/attachment.css">
		<link rel="stylesheet" href="dorado/scripts/attachement/attachment-container.css">
		<script type="text/javascript" src="dorado/boot.js"></script>
		<script type="text/javascript">$import("silk,grid,common-types,base-attach");</script>
		<script type="text/javascript">
			dorado.onInit(function() {
				var dataSet=new dorado.widget.DataSet({
					dataProvider:new dorado.AjaxDataProvider('data/phones.js'),
					dataType:'Phone'
                });

				new dorado.widget.ToolBar({
					renderTo:document.body,
					items:[{
                    caption:'插入',
                    onClick:function () {
                        var entityList=dataSet.getData('#.fjs');
                        entityList.insert({
							id:Math.ceil(Math.random()*1000),
							title:"我的文件.exe",
							size:800003299
						});
                    }
                },{
					    caption:'删除',
						onClick:function () {
					        var entityList=dataSet.getData('#.fjs');
					        var cEntity=entityList.current;
					        cEntity.remove();
                        }
					},{
					    caption:'项目更新',
						onClick:function(){
                            var cEntity=dataSet.getData('#.#fjs');
                            var i=0;
                            var int=setInterval(function () {
                                if(cEntity.get('status')!==0){
                                    cEntity.set('status',0);
                                }
                                cEntity.set('progress',i+++"%");
                                if(i>=100){
                                    cEntity.set('status',2);
                                    clearInterval(int);
								}
                            },25);
						}
					}]
				});
				new dorado.widget.DataGrid({
					renderTo:document.body,
                    dataSet:dataSet,
					height:200
				});
                new dorado.widget.DataGrid({
                    renderTo:document.body,
                    dataPath:'#.fjs',
                    dataSet:dataSet,
                    showFooter:true,
					height:200
                });
				new dorado.widget.AttachmentList({
					renderTo:document.body,
					dataPath:'#.fjs',
					dataSet:dataSet,
					showProgress:true,
                    onItemRemove:function(self,arg){
					}
					,onRenderItem:function (self,arg) {

                    },onItemDownload:function(self,arg){

					}
				});


			});



		</script>
	</head>
	<body style="height: 100%"></body>
</html>
